17.0 Introduction to Databases
Tags: #◇Computer Science #◇CCICOMP #◇Database #◇SQL #◇M8
◇Overview
This document provides a foundational introduction to databases. It covers the core concepts, the various types of database models (such as Relational and NoSQL), and the fundamental components that make up a database system. Additionally, it introduces Database Management Systems (DBMS) and provides a practical overview of Structured Query Language (SQL), covering both Data Definition Language (DDL) and Data Manipulation Language (DML) with common query examples.
◇Key Definitions
Database: An organized collection of structured data, typically stored and accessed electronically from a computer system. Database Management System (DBMS): Software that interacts with end users, applications, and the database itself to capture and analyze the data. It enables users to define, create, maintain, and control access (e.g., MySQL, Oracle, MongoDB). SQL (Structured Query Language): The standard language (standardized by ANSI) used for managing and manipulating relational databases. DDL (Data Definition Language): A subset of SQL commands used to define and modify the structure of the database (e.g., CREATE, ALTER, DROP). DML (Data Manipulation Language): A subset of SQL commands used to manipulate the data residing within the tables (e.g., SELECT, INSERT, UPDATE, DELETE).
◇Theoretical Framework
Components of a Database Data: The actual information being stored. Database Schema: The blueprint or structure of the database, including tables, fields, and relationships. Query Processor: The component that interprets and executes database queries. Indexes: Data structures that improve the speed of data retrieval operations.
Types of Databases
- Hierarchical Database: Data is organized in a tree-like structure with parent-child relationships (1-to-many).
- Network Database: Similar to hierarchical, but child records can have multiple parent records (many-to-many).
- Object-Oriented Database: Data is represented as objects and classes, useful for processing complex data rapidly.
- Relational Database: Stores data in tables consisting of rows (records) and columns (fields). Every piece of information has a relationship with others, maintained via Primary and Foreign Keys. Prioritizes data integrity.
- NoSQL Database: Non-relational database with a flexible hierarchy (similar to file folders). Lacks strict structure, allowing for rapid processing of large data volumes and high horizontal scalability. Frequently used in cloud computing.
Benefits and Applications Benefits: Efficient management, easy retrieval, scalability, robust data integrity/security, and concurrent access capabilities. Applications: Electronic health records (Healthcare), transaction processing (Finance), inventory management (Retail), user profiles (Social Media).
◇Worked Examples
Common SQL Commands
1. Data Definition Language (DDL): Creating a Table
CREATE TABLE employees (
name VARCHAR(50),
age INT,
department VARCHAR(50)
);
2. Data Manipulation Language (DML): Inserting Data
INSERT INTO employees (name, age, department)
VALUES ('John Doe', 35, 'Sales');
3. Data Manipulation Language (DML): Querying Data
SELECT name, age
FROM employees
WHERE age > 30;
4. Data Manipulation Language (DML): Updating Data
UPDATE employees
SET department = 'Marketing'
WHERE name = 'John Doe';
5. Data Manipulation Language (DML): Deleting Data
DELETE FROM employees
WHERE name = 'John Doe';
◇References & Navigation
- Previous Topic: ◇Software Development Process
- Related Notes: ◇Database and Its Environment, ◇Introduction to SQL
ACTIVE RECALL VERIFICATION
Select an answer to verify conceptual comprehension and reveal the technical rationale.
What is a Database Management System (DBMS)?
Which language is the standard used for managing and manipulating relational databases?
Which subset of SQL commands is used to define and modify the structure of the database (e.g., CREATE, ALTER)?
In database components, what is a Database Schema?
Which type of database stores data in tables of rows and columns, using Primary and Foreign Keys to maintain relationships?
What characterizes a NoSQL database compared to a relational one?
Which SQL command is part of the Data Manipulation Language (DML) used to add new records to a table?
What are Indexes used for in a database?
What type of database organizes data in a tree-like structure with 1-to-many parent-child relationships?
Which SQL clause is typically used with the SELECT command to filter the queried data based on specific conditions?